<template>
    <div class="layout" :class="layoutClass">
        <slot></slot>
    </div>
</template>

<script>
  export default {
    name: "f-layout"
    ,data(){
      return {
        layoutClass:{
          hasSider:false
        }
      }
    }
    /*,created() {
      console.log('created:',this.$children) //undefined
    }*/
    ,mounted() {
      // console.log('mounted:',this.$children[0].$options.name)
      this.$children.forEach(vm=>{
        if(vm.$options.name === 'f-sider'){
          this.layoutClass.hasSider = true;
        }
      })
    }
  }
</script>

<style lang="scss">
    .layout{
        display:flex;
        flex-direction: column;
        flex-grow:1; //自己是flex-item 那么自增长
        /*border:1px solid red;*/
        &.hasSider{
            flex-direction: row;
        }
    }
</style>
